﻿#Include RichText.ahk

g := Gui('AlwaysOnTop')
g.SetFont('s14', 'consolas')

bg := '1D2021'

g.AddText('x10 y10 w380', 'Try click Link below')

data := [
  EndLine(),
  HK('#z'), Op('::'), Fn(' Run '), Str('"'), Link('https://www.autohotkey.com'), Str('"'), Comment('  `; Win+Z'), EndLine(),
  EndLine(),
]

RichText(g, 10, 40, 480, data, { bg: bg, hardBreak: true, softBreak: true })

g.Show('w500 h200')
g.OnEvent('Close', (*) => ExitApp())

Esc:: ExitApp()

HK(str) => TextData.of(str, { bg: bg, fg: 'F94834', ex: 'bold' })
Op(str) => TextData.of(str, { bg: bg, fg: '8EC07C', ex: '' })
Fn(str) => TextData.of(str, { bg: bg, fg: '8EC07C', ex: '' })
Str(str) => TextData.of(str, { bg: bg, fg: 'B5B927', ex: '' })
Link(str) => TextData.of(str, { bg: bg, fg: 'ffb700', ex: 'underline' }).OnEvent('click', _ => Run(_.Text))
Comment(str) => TextData.of(str, { bg: bg, fg: '9a9a9a', ex: '' })
EndLine() => TextData.of('`n', { bg: bg, fg: 'ffffff', ex: '' })